<?php
namespace common\component;

use Yii;
use yii\web\Controller;
use cebe\markdown\Parser;
use yii\web\ForbiddenHttpException;
use common\models\LoginForm;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;

class Controller2015 extends Controller
{
    public function beforeAction($action)
    {
        if (\Yii::$app->user->isGuest){//var_dump(\Yii::$app->controller->action);var_dump(\Yii::$app->user);exit;
            //return $this->render('/site/login');
            if (\Yii::$app->controller->action->id == 'login') {
                return $this->action;
            }else {
                $this->redirect('http://blog/site/login');
            }
        }else {
            return $this->action;
        }
    }
}